#include"Heap.h"


void HeapSort(int* arr, int n)
{
	HP hp;
	HeapInit(&hp);
	for (int i = 0; i < n; i++)
	{
		HeapPush(&hp, arr[i]);
	}
	int i = 0;
	while (!HeapEmpty(&hp))
	{
		arr[i] = HeapTop(&hp);
		HeapPop(&hp);
		i++;
	}
	//HeapPrint(&hp);
	HeapDestroy(&hp);
}


void test1()
{
	//int a[] = { 3, 5, 15, 10, 18, 20, 15 };
	int arr[] = { 100,2255,236,1410,12,192,126,64,79 };
	int sz = sizeof(arr) / sizeof(int);
	HeapSort(arr, sz);
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}

}

int main()
{
	test1();
	return 0;
}
